<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="/common/taglibs.jsp"%>
<%@include file="/common/meta.jsp"%>
<title>使用单位选择</title>
</head>
<body>
	<table cellpadding="0" cellspacing="0" border="0" align="center" width="100%" style="margin: 10px auto;font-size: 14px;">
	<tr>
		<td height="25" align="right">企业名称:</td>
		<td height="25" align="left"><input id="sydwQymc" /></td>
		<td height="25" align="right">组织机构代码:</td>
		<td height="25" align="left"><input id="sydwZzjgdm" /></td>
	</tr>
	<tr>
		<td height="25" align="right">所属辖区:</td>
		<td height="25" align="left">
			<input id="xzqhName" readonly="readonly" onclick="showXzqh(this)" />
			<input id="xzqhCode" type="hidden" />
		</td>
		<td height="25" align="right">所属网格:</td>
		<td height="25" align="left">
			<input id="wgName" readonly="readonly" onclick="showWg(this)" />
			<input id="wgCode" type="hidden" />
		</td>
	</tr>
	</table>
	<div> 
		<input id="btn_cx" type="button" value="查询" style="background: #06a0ef; border: medium none; color: #fff; height: 20px; margin-left: 20px; outline: medium none; width: 50px;"/> 
		<input id="btn_czh" type="button" value="重置" style="background: #06a0ef; border: medium none; color: #fff; height: 20px; margin-left: 20px; outline: medium none; width: 50px;"/> 
		<input id="btn_xz" type="button" value="选择" style="background: #06a0ef; border: medium none; color: #fff; height: 20px; margin-left: 20px; outline: medium none; width: 50px;"/> 
	</div>
	<div id="sydwSelectGrid"></div>
	<script type="text/javascript">
	$(function(){
		$("#sydwSelectGrid").flexigrid({
			title:"使用单位信息",
			url:'<c:url value='/sydw/dataSelectGrid'/>',
			colModel:[
				{display: "组织机构代码", name: "sydwZzjgdm",width: 140},
				{display: "单位名称", name: "sydwQymc",width: 140},
				{display: "所属辖区", name: "sydwQhmc",width: 50},
				{display: "所属网格", name: "sydwWgqygs",width: 80},
				{display: "详细地址", name: "sydwZz",width: 160}
			],
			onDoubleClick: _rowDClick,
			height: 375,
			usepager: true
		});
		
		//查询
		$("#btn_cx").click(function() {
			$("#sydwSelectGrid").flexOptions({
				newp : 1,
				params : [ 
				           {name : 'sydwQymc', value : encodeURI($("#sydwQymc").val())},
				           {name : 'sydwZzjgdm', value : $("#sydwZzjgdm").val()},
				           {name : 'sydwQhdm', value : $("#xzqhCode").val()},
				           {name : 'sydwWgqygsId', value : $("#wgCode").val()}
						]
			}).flexReload();
		});
		
		//重置
		$("#btn_czh").click(function() {
			$("#sydwQymc").val("");
			$("#sydwZzjgdm").val("");
			$("#xzqhName").val("");
			$("#xzqhCode").val("");
			$("#wgName").val("");
			$("#wgCode").val("");
		});
		
		//选择
		$("#btn_xz").click(function() {
			var sydwTr=$('.trSelected');
			if(sydwTr.length == 1){
				_rowDClick(sydwTr,null,null);
			}
			//parent.artDialog.list["selectSydw"].close();
		});
		
	});
	
	//双击事件
	function _rowDClick(tdDiv, g, p) {
		var sydwid=$(tdDiv).attr("id").replace("row","");
		var sydwName=$("td:eq(1)",tdDiv).text();
		art.dialog.data('sydwId', sydwid);// 存储使用单位id
		art.dialog.data('sydwName', sydwName);// 存储使用单位名称
		art.artDialog.close();
	}
	</script>
	<script type="text/javascript" src="<c:url value="/common/js/zd/xzqh.js"/>" ></script>
	<script type="text/javascript" src="<c:url value="/common/js/zd/wg.js"/>" ></script>
</body>
</html>